// function to set a given theme/color-scheme function setTheme(themeName) { localStorage.setItem('hwtheme', themeName); document.documentElement.className = themeName; } // function to toggle between light and dark theme function toggleTheme() { if (localStorage.getItem('hwtheme') === 'hw-theme-dark') { setTheme('hw-theme-light'); } else { setTheme('hw-theme-dark'); } } // Immediately invoked function to set the theme on initial load (function () { if (localStorage.getItem('hwtheme') === 'hw-theme-dark') { setTheme('hw-theme-dark'); document.getElementById('darkslider').checked = false; } else { setTheme('hw-theme-light'); document.getElementById('darkslider').checked = true; } })(); function showDataWithImagesHW(topic) { var oXHR = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); function reportStatus() { if (oXHR.readyState == 4) // Request completed. showTheList(this.responseText); // All set. Now show the data. } oXHR.onreadystatechange = reportStatus; oXHR.open("GET", "/ads/table/json/"+topic+".json", true); // true = asynchronous request, false = synchronous request. oXHR.send(); function showTheList(json) { var arrItems = []; arrItems = JSON.parse(json); // Populate array with JSON data. var div = document.getElementById('slider_'+topic); // The parent